-
Notifications
You must be signed in to change notification settings - Fork 141
Add DEPENDS_EXPLICIT_ONLY to remove implicit dependencies #910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: rolling
Are you sure you want to change the base?
Add DEPENDS_EXPLICIT_ONLY to remove implicit dependencies #910
Conversation
Signed-off-by: Anthony Welte <[email protected]>
11f6223
to
1c25da9
Compare
Signed-off-by: Anthony Welte <[email protected]>
fd3eae4
to
ce8568e
Compare
I've updated the PR and tested on rhel9 and Ubuntu 24.04. The options is only used on Ubuntu (with cmake 3.28), on rhel9 the behavior is unchanged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. this will track only the listed dependencies in DEPENDS list, so that i can reduce possible spurious rebuilds due to inferred dependencies.
@InvincibleRMC @gavanderhoorn WDYT?
I'm no expert of cmake but from my understanding this looks good. |
DEPENDS ${target_dependencies} | ||
COMMENT "Generating type hashes for ROS interfaces" | ||
VERBATIM | ||
${_dep_explicit_only} |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually did but it doesn't work. I tried setting it to $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.27>:DEPENDS_EXPLICIT_ONLY>
but it's treated as just another argument to the previous option. Also tried to use it to set the variable (set(_dep_explicit_only "$<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.27>:DEPENDS_EXPLICIT_ONLY>")
) but it also didn't work.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Description
This PR addresses one of the build speedup mentioned in #859.
When
add_custom_command
is used to generate files that are then used by a target, theadd_custom_command
becomes implicitly dependent on the target dependencies. In rosidladd_custom_command
is used to generate files from the IDL files, the generator does not depend on anything else (except rosidl_generator_c[pp] whose generators depend on rosidl_generator_type_description).This PR (and the equivalent for rosidl_typesupport, rosidl_typesupport_fastrtps and rosidl_python) adds the
DEPENDS_EXPLICIT_ONLY
option of add_custom_command to most generators (except for C/CPP).Note
This option is only useful when using Ninja. When testing use
--cmake-args -GNinja
Since the generators are no longer constrained by unnecessary dependencies, they can start immediately. This speeds up the build significantly (2x for px4_msgs on my machine).
Warning
DEPENDS_EXPLICIT_ONLY requires cmake 3.27. The version that ships with Ubuntu 24.04 is 3.28, not sure about other supported distributions.
Right now I've bumped the required version to 3.27 but I could instead only add the option when the cmake version is sufficient (if that's preferable ?).Note
I wanted to also add the option to rosidl_generator_c[pp] and explicitly specify the dependency to rosidl_generator_type_description. I couldn't figure out how to make it work.
Is this user-facing behavior change?
Did you use Generative AI?
no
Additional Information
I've already created PRs for the other packages. I've set then to Draft until this PR is reviewed.